

<!doctype html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>skidl.part module &#8212; SKiDL 2.2.0 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
    <link rel="stylesheet" type="text/css" href="../_static/bizstyle.css?v=a66e137f" />
    
    <script src="../_static/documentation_options.js?v=b21de401"></script>
    <script src="../_static/doctools.js?v=9bcbadda"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../_static/bizstyle.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <!--[if lt IE 9]>
    <script src="_static/css3-mediaqueries.js"></script>
    <![endif]-->
  </head><body>
    <h1 id="site-title"><a href="../../../"><img src="../../../images/slim_banner.png" width="100%"></a></h1>
    
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SKiDL 2.2.0 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">skidl.part module</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-skidl.part">
<span id="skidl-part-module"></span><h1>skidl.part module<a class="headerlink" href="#module-skidl.part" title="Link to this heading">¶</a></h1>
<p>Handles parts in a circuit.</p>
<p>This module provides classes and functions for creating, managing, and connecting electronic parts
in a circuit. Parts can be instantiated from libraries, customized with attributes, and connected
to form complete circuits.</p>
<dl class="py class">
<dt class="sig sig-object py" id="skidl.part.Part">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">skidl.part.</span></span><span class="sig-name descname"><span class="pre">Part</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lib</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NETLIST</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">connections</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">part_defn</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">circuit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ref_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ref</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pin_splitters</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part" title="Link to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="skidl.mixins.html#skidl.mixins.PinMixin" title="skidl.mixins.PinMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">PinMixin</span></code></a>, <a class="reference internal" href="skidl.skidlbaseobj.html#skidl.skidlbaseobj.SkidlBaseObject" title="skidl.skidlbaseobj.SkidlBaseObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">SkidlBaseObject</span></code></a></p>
<p>A class for storing a definition of a schematic part.</p>
<p>This class represents electronic components in a schematic. Parts can be
instantiated from libraries, customized with attributes, and connected
together to form circuits.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lib</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em> or </em><a class="reference internal" href="skidl.schlib.html#skidl.schlib.SchLib" title="skidl.schlib.SchLib"><em>SchLib</em></a><em>, </em><em>optional</em>) – Either a SchLib object or a schematic part library file name.</p></li>
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – A string with name of the part to find in the library, or to assign to
the part defined by the part definition.</p></li>
<li><p><strong>dest</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – String that indicates where the part is destined for (e.g., NETLIST).</p></li>
<li><p><strong>tool</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – The format for the library file or part definition (e.g., KICAD).</p></li>
<li><p><strong>connections</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>, </em><em>optional</em>) – A dictionary with part pin names/numbers as keys and the
nets to which they will be connected as values. For example:
{ ‘IN-‘:a_in, ‘IN+’:gnd, ‘1’:AMPED_OUTPUT, ‘14’:vcc, ‘7’:gnd }</p></li>
<li><p><strong>part_defn</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>, </em><em>optional</em>) – A list of strings that define the part (usually read from a
schematic library file).</p></li>
<li><p><strong>circuit</strong> (<a class="reference internal" href="skidl.circuit.html#skidl.circuit.Circuit" title="skidl.circuit.Circuit"><em>Circuit</em></a><em>, </em><em>optional</em>) – The Circuit object this Part belongs to.</p></li>
<li><p><strong>ref_prefix</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – Prefix for part references such as ‘U’ or ‘J’.</p></li>
<li><p><strong>ref</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – A specific part reference to be assigned.</p></li>
<li><p><strong>tag</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – A specific tag to tie the part to its footprint in the PCB.</p></li>
<li><p><strong>pin_splitters</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – String of characters that split long pin names into shorter aliases.</p></li>
</ul>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>kwargs</strong> – Name/value pairs for setting attributes for the part.
For example, manf_num=’LM4808MP-8’ would create an attribute
named ‘manf_num’ for the part and assign it the value ‘LM4808MP-8’.</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><a class="reference external" href="https://docs.python.org/3.13/library/exceptions.html#ValueError" title="(in Python v3.13)"><strong>ValueError</strong></a> – If the part library and definition are both missing.</p></li>
<li><p><a class="reference external" href="https://docs.python.org/3.13/library/exceptions.html#ValueError" title="(in Python v3.13)"><strong>ValueError</strong></a> – If an unknown file format is requested.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.name">
<span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#skidl.part.Part.name" title="Link to this definition">¶</a></dt>
<dd><p>The part name.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.description">
<span class="sig-name descname"><span class="pre">description</span></span><a class="headerlink" href="#skidl.part.Part.description" title="Link to this definition">¶</a></dt>
<dd><p>Description of the part.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.ref">
<span class="sig-name descname"><span class="pre">ref</span></span><a class="headerlink" href="#skidl.part.Part.ref" title="Link to this definition">¶</a></dt>
<dd><p>Reference designator for the part (e.g., ‘R1’, ‘U3’).</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.ref_prefix">
<span class="sig-name descname"><span class="pre">ref_prefix</span></span><a class="headerlink" href="#skidl.part.Part.ref_prefix" title="Link to this definition">¶</a></dt>
<dd><p>Prefix for the reference (e.g., ‘R’, ‘U’).</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.pins">
<span class="sig-name descname"><span class="pre">pins</span></span><a class="headerlink" href="#skidl.part.Part.pins" title="Link to this definition">¶</a></dt>
<dd><p>List of Pin objects for this part.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)">list</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.unit">
<span class="sig-name descname"><span class="pre">unit</span></span><a class="headerlink" href="#skidl.part.Part.unit" title="Link to this definition">¶</a></dt>
<dd><p>Dictionary for storing subunits of the part.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#dict" title="(in Python v3.13)">dict</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.circuit">
<span class="sig-name descname"><span class="pre">circuit</span></span><a class="headerlink" href="#skidl.part.Part.circuit" title="Link to this definition">¶</a></dt>
<dd><p>The circuit this part belongs to.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="skidl.circuit.html#skidl.circuit.Circuit" title="skidl.circuit.Circuit">Circuit</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.attached_to">
<span class="sig-name descname"><span class="pre">attached_to</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nets</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.attached_to"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.attached_to" title="Link to this definition">¶</a></dt>
<dd><p>Return True if any part pin is connected to a net in the list.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>nets</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>, </em><em>optional</em>) – List of nets to check for connection.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>True if part is connected to any of the nets, False otherwise.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/functions.html#bool" title="(in Python v3.13)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.convert_for_spice">
<span class="sig-name descname"><span class="pre">convert_for_spice</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">spice_part</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pin_map</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.convert_for_spice"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.convert_for_spice" title="Link to this definition">¶</a></dt>
<dd><p>Convert a Part object for use with SPICE.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>spice_part</strong> (<a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part"><em>Part</em></a>) – The type of SPICE Part to be converted to.</p></li>
<li><p><strong>pin_map</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a>) – Dict with pin numbers/names of self as keys and num/names of spice_part pins as replacement values.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.copy">
<span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">num_copies</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NETLIST</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">circuit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">io</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">attribs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.copy"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.copy" title="Link to this definition">¶</a></dt>
<dd><p>Make zero or more copies of this part while maintaining all pin/net connections.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>num_copies</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a><em>, </em><em>optional</em>) – Number of copies to make of this part.</p></li>
<li><p><strong>dest</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – Indicates where the copy is destined for (e.g., NETLIST).</p></li>
<li><p><strong>circuit</strong> (<a class="reference internal" href="skidl.circuit.html#skidl.circuit.Circuit" title="skidl.circuit.Circuit"><em>Circuit</em></a><em>, </em><em>optional</em>) – The circuit this part should be added to.</p></li>
<li><p><strong>io</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>, </em><em>optional</em>) – XSPICE I/O names.</p></li>
</ul>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>attribs</strong> – Name/value pairs for setting attributes for the copy.</p>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>A list of Part copies or a single Part if num_copies==1.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part">Part</a> or <a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)">list</a></p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/exceptions.html#ValueError" title="(in Python v3.13)"><strong>ValueError</strong></a> – If the requested number of copies is a non-integer or negative.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>An instance of a part can be copied just by calling it like so:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">res</span> <span class="o">=</span> <span class="n">Part</span><span class="p">(</span><span class="s2">&quot;Device&quot;</span><span class="p">,</span><span class="s1">&#39;R&#39;</span><span class="p">)</span>    <span class="c1"># Get a resistor.</span>
<span class="n">res_copy</span> <span class="o">=</span> <span class="n">res</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="s1">&#39;1K&#39;</span><span class="p">)</span>  <span class="c1"># Copy the resistor and set resistance value.</span>
</pre></div>
</div>
<p>You can also use the multiplication operator to make copies:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cap</span> <span class="o">=</span> <span class="n">Part</span><span class="p">(</span><span class="s2">&quot;Device&quot;</span><span class="p">,</span> <span class="s1">&#39;C&#39;</span><span class="p">)</span>   <span class="c1"># Get a capacitor</span>
<span class="n">caps</span> <span class="o">=</span> <span class="mi">10</span> <span class="o">*</span> <span class="n">cap</span>             <span class="c1"># Make an array with 10 copies of it.</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.copy_units">
<span class="sig-name descname"><span class="pre">copy_units</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.copy_units"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.copy_units" title="Link to this definition">¶</a></dt>
<dd><p>Make copies of the units from the source part.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>src</strong> (<a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part"><em>Part</em></a>) – The source part containing units to copy.</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/exceptions.html#Exception" title="(in Python v3.13)"><strong>Exception</strong></a> – If an illegal unit type is encountered.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.create_network">
<span class="sig-name descname"><span class="pre">create_network</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.create_network"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.create_network" title="Link to this definition">¶</a></dt>
<dd><p>Create a network from the pins of a part.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>A network containing the part’s pins.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="skidl.network.html#skidl.network.Network" title="skidl.network.Network">Network</a></p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/exceptions.html#Exception" title="(in Python v3.13)"><strong>Exception</strong></a> – If the part has more than 2 pins.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.erc_desc">
<span class="sig-name descname"><span class="pre">erc_desc</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.erc_desc"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.erc_desc" title="Link to this definition">¶</a></dt>
<dd><p>Create description of part for ERC and other error reporting.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>A string description in the form “name/ref”</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="skidl.part.Part.erc_list">
<span class="sig-name descname"><span class="pre">erc_list</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">[&lt;function</span> <span class="pre">dflt_part_erc&gt;]</span></em><a class="headerlink" href="#skidl.part.Part.erc_list" title="Link to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.export">
<span class="sig-name descname"><span class="pre">export</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">addtl_part_attrs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.export"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.export" title="Link to this definition">¶</a></dt>
<dd><p>Return a string to recreate a Part object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>addtl_part_attrs</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>, </em><em>optional</em>) – List of additional part attribute names to include in export.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>String that can be evaluated to rebuild the Part object.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.Part.foot">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">foot</span></span><a class="headerlink" href="#skidl.part.Part.foot" title="Link to this definition">¶</a></dt>
<dd><p>Get the part footprint.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The part’s footprint.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.generate_svg_component">
<span class="sig-name descname"><span class="pre">generate_svg_component</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">symtx</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tool</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">net_stubs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.generate_svg_component"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.generate_svg_component" title="Link to this definition">¶</a></dt>
<dd><p>Generate the SVG for displaying a part in an SVG schematic.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>symtx</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – Transform for the SVG symbol. Defaults to “”.</p></li>
<li><p><strong>tool</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>, </em><em>optional</em>) – Tool format to use for SVG generation. Defaults to config.tool.</p></li>
<li><p><strong>net_stubs</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>, </em><em>optional</em>) – List of net stubs to include in the SVG.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>SVG representation of the component.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.get">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">circuit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.get"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.get" title="Link to this definition">¶</a></dt>
<dd><p>Get the part with the given text from a circuit, or return None.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>text</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – A text string that will be searched for in the list of
parts.</p>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>circuit</strong> (<a class="reference internal" href="skidl.circuit.html#skidl.circuit.Circuit" title="skidl.circuit.Circuit"><em>Circuit</em></a><em>, </em><em>optional</em>) – The circuit whose parts will be searched. If set to None,
then the parts in the default_circuit will be searched.</p>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p><dl class="simple">
<dt>A list of parts or a single part that match the text string with</dt><dd><p>either their reference, name, alias, or their description.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part">Part</a> or <a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#list" title="(in Python v3.13)">list</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.grab_pins">
<span class="sig-name descname"><span class="pre">grab_pins</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.grab_pins"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.grab_pins" title="Link to this definition">¶</a></dt>
<dd><p>Grab pins back from PartUnits.</p>
<p>Makes each unit release its pins back to the part that contains it.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.Part.hiername">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hiername</span></span><a class="headerlink" href="#skidl.part.Part.hiername" title="Link to this definition">¶</a></dt>
<dd><p>Return the hierarchical name of the part.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The hierarchical name including hierarchy prefix and tag.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.Part.hiertuple">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hiertuple</span></span><a class="headerlink" href="#skidl.part.Part.hiertuple" title="Link to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.is_connected">
<span class="sig-name descname"><span class="pre">is_connected</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.is_connected"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.is_connected" title="Link to this definition">¶</a></dt>
<dd><p>Return T/F depending upon whether a part is connected in a netlist.</p>
<p>If a part has pins but none of them are connected to nets, then
this method will return False. Otherwise, it will return True even if
the part has no pins (which can be the case for mechanical parts,
silkscreen logos, or other non-electrical schematic elements).</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>True if the part is connected or has no pins, False otherwise.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/functions.html#bool" title="(in Python v3.13)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.is_movable">
<span class="sig-name descname"><span class="pre">is_movable</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.is_movable"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.is_movable" title="Link to this definition">¶</a></dt>
<dd><p>Return T/F if the part can be moved from one circuit into another.</p>
<dl class="simple">
<dt>This method returns true if:</dt><dd><ol class="arabic simple">
<li><p>the part is not in a circuit, or</p></li>
<li><p>the part has pins but none of them are connected to nets, or</p></li>
<li><p>the part has no pins (which can be the case for mechanical parts,
silkscreen logos, or other non-electrical schematic elements).</p></li>
</ol>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>True if the part can be moved to another circuit, False otherwise.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/functions.html#bool" title="(in Python v3.13)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.make_unit">
<span class="sig-name descname"><span class="pre">make_unit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">label</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">pin_ids</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">criteria</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.make_unit"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.make_unit" title="Link to this definition">¶</a></dt>
<dd><p>Create a PartUnit from a set of pins in a Part object.</p>
<p>Parts can be organized into smaller pieces called PartUnits. A PartUnit
acts like a Part but contains only a subset of the pins of the Part.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – The label used to identify the PartUnit.</p></li>
<li><p><strong>pin_ids</strong> – A list of strings containing pin names, numbers,
regular expressions, slices, lists or tuples.</p></li>
</ul>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>criteria</strong> – Key/value pairs that specify attribute values the
pin must have in order to be selected.</p>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The newly created part unit.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#skidl.part.PartUnit" title="skidl.part.PartUnit">PartUnit</a></p>
</dd>
</dl>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Will issue a warning if the unit label collides with any part pin names.</p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.parse">
<span class="sig-name descname"><span class="pre">parse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">partial_parse</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.parse"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.parse" title="Link to this definition">¶</a></dt>
<dd><p>Create a part from its stored part definition.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>partial_parse</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a><em>, </em><em>optional</em>) – When true, just get the name and aliases for the
part. Leave the rest unparsed. Defaults to False.</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.Part.partclasses">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">partclasses</span></span><a class="headerlink" href="#skidl.part.Part.partclasses" title="Link to this definition">¶</a></dt>
<dd><p>Get all part classes associated with this part.</p>
<p>Returns the combined set of part classes from both the hierarchical nodes
surrounding this part and the part classes directly assigned to this part.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p><dl class="simple">
<dt>A set containing all part classes from the node hierarchy and</dt><dd><p>the part’s directly assigned classes.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#set" title="(in Python v3.13)">set</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="id0">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ref</span></span><a class="headerlink" href="#id0" title="Link to this definition">¶</a></dt>
<dd><p>Get the part reference.</p>
<p>When setting the part reference, if another part with the same
reference is found, the reference for this part is adjusted to make
it unique.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The part’s reference designator.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.release_pins">
<span class="sig-name descname"><span class="pre">release_pins</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.release_pins"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.release_pins" title="Link to this definition">¶</a></dt>
<dd><p>A Part can’t release pins back to its PartUnits, so do nothing.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.rmv_unit">
<span class="sig-name descname"><span class="pre">rmv_unit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">label</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.rmv_unit"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.rmv_unit" title="Link to this definition">¶</a></dt>
<dd><p>Remove a PartUnit from a Part.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – Label of unit to remove.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.similarity">
<span class="sig-name descname"><span class="pre">similarity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">part</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">options</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.similarity"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.similarity" title="Link to this definition">¶</a></dt>
<dd><p>Return a measure of how similar two parts are.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>part</strong> (<a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part"><em>Part</em></a>) – The part to compare to for similarity.</p></li>
<li><p><strong>options</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a>) – Dictionary of options and settings affecting similarity computation.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Value for similarity (larger means more similar).</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/functions.html#float" title="(in Python v3.13)">float</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.Part.tag_ref_name">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">tag_ref_name</span></span><a class="headerlink" href="#skidl.part.Part.tag_ref_name" title="Link to this definition">¶</a></dt>
<dd><p>Return the tag, reference, or name of an object.</p>
<p>This provides a way to retrieve the most relevant identifier for the object.
If the tag is set, it will be returned. Otherwise, if the reference is set,
it will be returned. If all else fails, the name will be returned.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The tag, reference, or name of the object.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.validate">
<span class="sig-name descname"><span class="pre">validate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.validate"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.validate" title="Link to this definition">¶</a></dt>
<dd><p>Check that pins and units reference the correct part that owns them.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/exceptions.html#AssertionError" title="(in Python v3.13)"><strong>AssertionError</strong></a> – If pins or units don’t properly reference this part.</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.Part.value">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">value</span></span><a class="headerlink" href="#skidl.part.Part.value" title="Link to this definition">¶</a></dt>
<dd><p>Get the part value.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The part’s value, or part name if no value is set.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.Part.value_to_str">
<span class="sig-name descname"><span class="pre">value_to_str</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#Part.value_to_str"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.Part.value_to_str" title="Link to this definition">¶</a></dt>
<dd><p>Return value of part as a string.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>String representation of the part’s value.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="skidl.part.PartUnit">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">skidl.part.</span></span><span class="sig-name descname"><span class="pre">PartUnit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parent</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">label</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">pin_ids</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">criteria</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#PartUnit"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.PartUnit" title="Link to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part"><code class="xref py py-class docutils literal notranslate"><span class="pre">Part</span></code></a></p>
<p>Create a PartUnit from a set of pins in a Part object.</p>
<p>Parts can be organized into smaller pieces called PartUnits. A PartUnit
acts like a Part but contains only a subset of the pins of the Part.
Except for the pins, the PartUnit is a shallow copy of the Part and
cannot store any other unique data.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>part</strong> (<a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part"><em>Part</em></a>) – This is the parent Part whose pins the PartUnit is built from.</p></li>
<li><p><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – A unique label for this unit.</p></li>
<li><p><strong>pin_ids</strong> – A list of strings containing pin names, numbers,
regular expressions, slices, lists or tuples. If empty, it
will match <em>every</em> pin of the part.</p></li>
</ul>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>criteria</strong> – Key/value pairs that specify attribute values the
pin must have in order to be selected.</p></li>
<li><p><strong>unit</strong> (<a class="reference external" href="https://docs.python.org/3.13/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – Unit number assigned to this PartUnit. Defaults to 1.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>This will return unit 1 from a part:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">lm358</span> <span class="o">=</span> <span class="n">Part</span><span class="p">(</span><span class="s1">&#39;linear&#39;</span><span class="p">,</span><span class="s1">&#39;lm358&#39;</span><span class="p">)</span>
<span class="n">lm358a</span> <span class="o">=</span> <span class="n">PartUnit</span><span class="p">(</span><span class="n">lm358</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<p>Or you can specify the pins directly:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">lm358a</span> <span class="o">=</span> <span class="n">PartUnit</span><span class="p">(</span><span class="n">lm358</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.PartUnit.add_pins_from_parent">
<span class="sig-name descname"><span class="pre">add_pins_from_parent</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">pin_ids</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">criteria</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#PartUnit.add_pins_from_parent"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.PartUnit.add_pins_from_parent" title="Link to this definition">¶</a></dt>
<dd><p>Add selected pins from the parent to the part unit.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>pin_ids</strong> – Pin names/numbers to add from parent.</p>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>criteria</strong> – Key/value pairs for selecting pins.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.PartUnit.export">
<span class="sig-name descname"><span class="pre">export</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#PartUnit.export"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.PartUnit.export" title="Link to this definition">¶</a></dt>
<dd><p>Return a string describing the PartUnit for exporting purposes.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Dictionary representation of the unit as a string.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.PartUnit.grab_pins">
<span class="sig-name descname"><span class="pre">grab_pins</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#PartUnit.grab_pins"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.PartUnit.grab_pins" title="Link to this definition">¶</a></dt>
<dd><p>Grab pin from Part and assign to PartUnit.</p>
<p>This changes each pin’s part reference to point to this unit.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.PartUnit.hiertuple">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hiertuple</span></span><a class="headerlink" href="#skidl.part.PartUnit.hiertuple" title="Link to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.part.PartUnit.ref">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ref</span></span><a class="headerlink" href="#skidl.part.PartUnit.ref" title="Link to this definition">¶</a></dt>
<dd><p>Get the unit’s hierarchical reference.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Reference in the form “parent_ref.label”</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3.13/library/stdtypes.html#str" title="(in Python v3.13)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.PartUnit.release_pins">
<span class="sig-name descname"><span class="pre">release_pins</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#PartUnit.release_pins"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.PartUnit.release_pins" title="Link to this definition">¶</a></dt>
<dd><p>Return PartUnit pins to parent Part.</p>
<p>This changes each pin’s part reference to point back to the parent part.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.part.PartUnit.validate">
<span class="sig-name descname"><span class="pre">validate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#PartUnit.validate"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.PartUnit.validate" title="Link to this definition">¶</a></dt>
<dd><p>Check that unit pins point to the parent part.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3.13/library/exceptions.html#AssertionError" title="(in Python v3.13)"><strong>AssertionError</strong></a> – If pins don’t refer to the parent part.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="skidl.part.default_empty_footprint_handler">
<span class="sig-prename descclassname"><span class="pre">skidl.part.</span></span><span class="sig-name descname"><span class="pre">default_empty_footprint_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">part</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/part.html#default_empty_footprint_handler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.part.default_empty_footprint_handler" title="Link to this definition">¶</a></dt>
<dd><p>Handle the situation of a Part with no footprint when generating netlist/PCB.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>part</strong> (<a class="reference internal" href="#skidl.part.Part" title="skidl.part.Part"><em>Part</em></a>) – The part with no footprint.</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>By default, this function logs an error message if the footprint is missing.
Override this function if you want to try and set some default footprint
for particular types of parts (such as using an 0805 footprint for a resistor).</p>
</div>
</dd></dl>

</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
  <div>
    <h3><a href="../index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">skidl.part module</a><ul>
<li><a class="reference internal" href="#skidl.part.Part"><code class="docutils literal notranslate"><span class="pre">Part</span></code></a><ul>
<li><a class="reference internal" href="#skidl.part.Part.name"><code class="docutils literal notranslate"><span class="pre">Part.name</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.description"><code class="docutils literal notranslate"><span class="pre">Part.description</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.ref"><code class="docutils literal notranslate"><span class="pre">Part.ref</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.ref_prefix"><code class="docutils literal notranslate"><span class="pre">Part.ref_prefix</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.pins"><code class="docutils literal notranslate"><span class="pre">Part.pins</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.unit"><code class="docutils literal notranslate"><span class="pre">Part.unit</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.circuit"><code class="docutils literal notranslate"><span class="pre">Part.circuit</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.attached_to"><code class="docutils literal notranslate"><span class="pre">Part.attached_to()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.convert_for_spice"><code class="docutils literal notranslate"><span class="pre">Part.convert_for_spice()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.copy"><code class="docutils literal notranslate"><span class="pre">Part.copy()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.copy_units"><code class="docutils literal notranslate"><span class="pre">Part.copy_units()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.create_network"><code class="docutils literal notranslate"><span class="pre">Part.create_network()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.erc_desc"><code class="docutils literal notranslate"><span class="pre">Part.erc_desc()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.erc_list"><code class="docutils literal notranslate"><span class="pre">Part.erc_list</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.export"><code class="docutils literal notranslate"><span class="pre">Part.export()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.foot"><code class="docutils literal notranslate"><span class="pre">Part.foot</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.generate_svg_component"><code class="docutils literal notranslate"><span class="pre">Part.generate_svg_component()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.get"><code class="docutils literal notranslate"><span class="pre">Part.get()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.grab_pins"><code class="docutils literal notranslate"><span class="pre">Part.grab_pins()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.hiername"><code class="docutils literal notranslate"><span class="pre">Part.hiername</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.hiertuple"><code class="docutils literal notranslate"><span class="pre">Part.hiertuple</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.is_connected"><code class="docutils literal notranslate"><span class="pre">Part.is_connected()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.is_movable"><code class="docutils literal notranslate"><span class="pre">Part.is_movable()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.make_unit"><code class="docutils literal notranslate"><span class="pre">Part.make_unit()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.parse"><code class="docutils literal notranslate"><span class="pre">Part.parse()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.partclasses"><code class="docutils literal notranslate"><span class="pre">Part.partclasses</span></code></a></li>
<li><a class="reference internal" href="#id0"><code class="docutils literal notranslate"><span class="pre">Part.ref</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.release_pins"><code class="docutils literal notranslate"><span class="pre">Part.release_pins()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.rmv_unit"><code class="docutils literal notranslate"><span class="pre">Part.rmv_unit()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.similarity"><code class="docutils literal notranslate"><span class="pre">Part.similarity()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.tag_ref_name"><code class="docutils literal notranslate"><span class="pre">Part.tag_ref_name</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.validate"><code class="docutils literal notranslate"><span class="pre">Part.validate()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.value"><code class="docutils literal notranslate"><span class="pre">Part.value</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.Part.value_to_str"><code class="docutils literal notranslate"><span class="pre">Part.value_to_str()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#skidl.part.PartUnit"><code class="docutils literal notranslate"><span class="pre">PartUnit</span></code></a><ul>
<li><a class="reference internal" href="#skidl.part.PartUnit.add_pins_from_parent"><code class="docutils literal notranslate"><span class="pre">PartUnit.add_pins_from_parent()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.PartUnit.export"><code class="docutils literal notranslate"><span class="pre">PartUnit.export()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.PartUnit.grab_pins"><code class="docutils literal notranslate"><span class="pre">PartUnit.grab_pins()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.PartUnit.hiertuple"><code class="docutils literal notranslate"><span class="pre">PartUnit.hiertuple</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.PartUnit.ref"><code class="docutils literal notranslate"><span class="pre">PartUnit.ref</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.PartUnit.release_pins"><code class="docutils literal notranslate"><span class="pre">PartUnit.release_pins()</span></code></a></li>
<li><a class="reference internal" href="#skidl.part.PartUnit.validate"><code class="docutils literal notranslate"><span class="pre">PartUnit.validate()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#skidl.part.default_empty_footprint_handler"><code class="docutils literal notranslate"><span class="pre">default_empty_footprint_handler()</span></code></a></li>
</ul>
</li>
</ul>

  </div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/rst_output/skidl.part.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SKiDL 2.2.0 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">skidl.part module</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
    &#169; Copyright 2016-2025, Dave Vandenbout.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
    </div>
  </body>
</html>